<template>
  <div class="app">
    <!-- 头部 header-->
    <van-nav-bar
      :title="title"
      left-text="返回"
      left-arrow
      @click-left="onClickLeft"
    />
    <!-- 中间切换的页面 -->
    <router-view></router-view>

    <!-- 底部  footer-->
    <van-tabbar v-model="active">
      <!-- active  默认选择第几个 (写下标)-->
      <van-tabbar-item
        icon="home-o"
        to="/home"
      >标签</van-tabbar-item>
      <van-tabbar-item
        icon="friends-o"
        to='/fiends'
      >标签</van-tabbar-item>
      <van-tabbar-item
        icon="cart-o"
        badge="9"
        to="cart"
      >标签</van-tabbar-item>
      <van-tabbar-item
        icon="search"
        to='/search'
      >标签</van-tabbar-item>
    </van-tabbar>

  </div>
</template>
<script>
export default {
  data () {
    return {
      title: '首页',
      active: 0
    }
  },
  methods: {
    onClickLeft () {
      this.$router.go(-1)
    }
  }
}
</script>
<style lang="scss" scoped>
</style>
